package com.xiangxiao.rpan.storage.cos;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

/**
 * @ClassName CosClientRunner
 * @Auther admin
 * @Email 573768011@qq.com
 * @Date 2024/9/2 17:21
 */
@Component
@ConditionalOnProperty(prefix = "rpan.storage.processor", name = "type", havingValue = "com.xiangxiao.rpan.storage.cos.CosStorageProcessor")
public class CosClientRunner implements ApplicationRunner, DisposableBean {
  @Override
  public void run(ApplicationArguments args) throws Exception {
    CosStorageConfig.initCosClient();
  }

  @Override
  public void destroy() throws Exception {
    CosStorageConfig.shutdownClient();
  }
}
